#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Time    : 2025/6/21 7:19
# @Author  : summer
# @Email   : 610658552@qq.com
# @File    : rsp.py
# @Software: PyCharm
# @Desc    :

from rest_framework.response import Response
from rest_framework import status


def success_response(data=None, success=True, message="操作成功"):
    return Response({
        "success": success,
        "code": 200,
        "message": message,
        "data": data,
    }, status=status.HTTP_200_OK)


def error_response(data=None, success=False, message="操作失败", code=400):
    return Response({
        "success": success,
        "code": code,
        "message": message,
        "data": data,
    }, status=status.HTTP_200_OK)
